var axios = require('axios');
var data = JSON.stringify({
   "model": "claude-3-5-sonnet-20241022",
   "messages": [
      {
         "role": "user",
         "content": "生成一个菜谱大全网站，用 react、ts 写，用 json 形式返回，key 是文件目录，value 是文件内容"
      }
   ]
});

var config = {
   method: 'post',
   url: 'https://api.302.ai/v1/chat/completions',
   headers: { 
      'Accept': 'application/json', 
      'Authorization': 'sk-AwwcMZ3jfGMjcgcqDkVptjuaJe63wOl70v4GQIolkDAMdQ9V', 
      'Content-Type': 'application/json'
   },
   data : data
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data, null, 4));
})
.catch(function (error) {
   console.log(error);
});
